package cn.liyiming.bbs.modular.system.service;

import cn.liyiming.bbs.modular.system.model.Like;
import cn.liyiming.bbs.modular.system.model.LikedCountDTO;

import java.util.List;

/**
 * @author 立以宁
 */
public interface IRedisService {

    /**
     * 点赞。状态为1
     * @param likedArticleId
     * @param likedUserId
     */
    void saveLiked2Redis(Integer likedArticleId, Integer likedUserId);

    /**
     * 取消点赞。将状态改变为0
     * @param likedArticleId
     * @param likedUserId
     */
    void unlikeFromRedis(Integer likedArticleId, Integer likedUserId);

    /**
     * 从Redis中删除一条点赞数据
     * @param likedArticleId
     * @param likedUserId
     */
    void deleteLikedFromRedis(Integer likedArticleId, Integer likedUserId);

    /**
     * 该用户的点赞数加1
     * @param likedArticleId
     */
    void incrementLikedCount(Integer likedArticleId);

    /**
     * 该用户的点赞数减1
     * @param likedArticleId
     */
    void decrementLikedCount(Integer likedArticleId);

    /**
     * 获取Redis中存储的所有点赞数据
     * @return
     */
    List<Like> getLikedDataFromRedis();

    /**
     * 获取Redis中存储的所有点赞数量
     * @return
     */
    List<LikedCountDTO> getLikedCountFromRedis();
}
